package com.hfuu.controller.activity;

import com.hfuu.model.ResponseEntity;
import com.hfuu.model.ResponseEntityBuilder;
import com.hfuu.service.activity.ActivityService;
import com.hfuu.service.activity.request.ActivityRequest;
import com.hfuu.service.activity.response.ActivityDetailResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.ws.rs.core.MediaType;
import java.util.List;

@Api(tags="活动评价详情控制类")
@RestController
@RequestMapping("/api/activityDetail")
public class ActivityDetailController {

    @Autowired
    private ActivityService activityService;

    @ApiOperation("查询活动评价")
    @RequestMapping(value = "/listActivityDetail", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON)
    @ResponseBody
    public ResponseEntity<List<ActivityDetailResponse>> listActivityDetail(@RequestBody ActivityRequest request)
            throws Exception{
        return ResponseEntityBuilder.success(activityService.listActivityDetail(request));
    }

    @ApiOperation("更新活动评价")
    @RequestMapping(value = "/updateActivityDetail", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON)
    @ResponseBody
    public ResponseEntity<Integer> updateActivityDetail(@RequestBody ActivityRequest request)
            throws Exception{
        return ResponseEntityBuilder.success(activityService.updateActivityDetail(request));
    }

}
